package com.stanley.alogrithm.kt

class Login {
}

fun main() {
//    login("SS", "123") {
//        if(it) {
//            println("Login Success.")
//        } else {
//            println("Login failed.")
//        }
//    }
    login2 {
            if (it)
                println("Login success.")
            else
                println("Login failed....")
    }
}
fun login2( resultAction:(Boolean)-> Unit) {
    println("I don't know the result.")
    resultAction(false)
}

fun login(name:String, pwd:String, resultAction:(Boolean)-> Unit) {
    if (name == "s" && pwd == "123") {
        resultAction(true)
    } else {
        resultAction(false)
    }
}

